package top.hkyzf.study.j2se.syy.bill;

/**
 * 含有打折的账单明细类
 * @author 朱峰
 * @date 2021-6-24 15:15
 */
public class DiscountBill extends ConcreteBill {
    // 折扣率
    private float discountRate;

    public DiscountBill(float discountRate) {
        this.discountRate = discountRate;
    }

    // 先打印正常消费明细，然后打印折扣信息
    @Override
    public void printBill() {
        super.printBill();
        System.out.println("折扣率：" + discountRate);
        System.out.println("优惠金额：" + getTotal() * discountRate);
    }
}
